<?php

namespace App\Models\Factory;


use App\Models\AbsModelFactory;
use App\Models\Orm\AwUserInvite;
use App\Models\Orm\UserInviteLog;


/**
 * 用户工厂
 * Class UserFactory
 * @package App\Models\Factory
 */
class UserInviteFactory extends AbsModelFactory
{
    //通过被邀请的手机号,拿到邀请人的id
    public  static  function getUserId($mobile)
    {
       $user = UserInviteLog::where('mobile',$mobile)->first();
        return $user ? $user : '';
    }

    //通过被邀请的手机号,拿到邀请人的id
    public  static  function getInviteUserId($mobile)
    {
        $result = AwUserInvite::where('phone',$mobile)->first();
        return $result ? $result -> id : '';
    }

    //判断被邀请人是否存在
    public static function isInvite($invite_id)
    {
        $result = AwUserInvite::where('invited_id',$invite_id)->first();

        return $result ? $result : false;
    }
}